package fourfaith.com.ff_sl21_app.utils;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

public class SpaceItemDecoration extends RecyclerView.ItemDecoration{

    private int space;
    private RecyclerView.Adapter adapter;

    public SpaceItemDecoration(RecyclerView.Adapter adapter, int space) {

//        final float scale = ContextApplication.getAppContext().getResources().getDisplayMetrics().density;
//
//        this.space = (int) (space * scale + 0.5f);
        this.space = space;
        this.adapter = adapter;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

        outRect.left = space;
        outRect.top = space;
        outRect.bottom = space;
        outRect.right = space;

//        if(parent.getChildPosition(view) != 0)//getChildAdapterPosition
//            outRect.top = space;

    }
}